Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
How to fix warning "eslint-disable-next-line no-unused-expressions"?

I'm using Chai to write some unit tests. I'm doing two assertions on an array of strings. I'm asserting the array is an actual array & it contains only strings. Both assertions are passing & working properly. However, in the second assertion, I'm getting this warning: eslint-disable-next-line no-unused-expressions. I'm unsure of how to fix this warning before ignoring it. How can I accomplish this?

import { assert, expect } from 'chai';
import { prContributors } from './pr-contributors.js';

describe('Pull Request Contributor List array', () => {
  it('should be an array', () => {
    assert.isArray(prContributors, 'prContributors is an array');
  });

  it('should contain only strings', () => {
    // eslint-disable-next-line no-unused-expressions
    expect(prContributors.every((contributor) => typeof contributor === 'string')).to.be.true;
  });
});

I was able to fix it by storing the results in a variable & print it, but I don't want to add an unnecessary console.log() & I traded a warning for another.

it('should contain only strings', () => {
    const result = prContributors.every((contributor) => typeof contributor === 'string');
    console.log(result); // now I traded the warning :(
});

I also try this:

it('should contain only strings', () => {
    const result = prContributors.every((contributor) => typeof contributor === 'string');
    expect(result).to.be.true; // still got the warning
});

However, the warning is still there.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda